package NewCoder;

public class BM8 {
    public ListNode FindKthToTail (ListNode pHead, int k) {
        // write code here
        if(pHead==null || k==0) return null;
        ListNode node=pHead;
        int len=0;
        while(node!=null){
            len++;
            node=node.next;
        }
        if(k>len) return null;
        for(int i=0;i<len-k;i++){
            pHead=pHead.next;
        }
        return pHead;

    }
}
